package com.zyf.spit.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zyf.spit.dao.SpitDao;
import com.zyf.spit.pojo.Spit;
import entity.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpitServiceImpl {
    @Autowired
    SpitDao spitDao;
    @Autowired
    IdWorker idWorker;

    public PageInfo<String> selectContentListByUserId(String userid, int pageNum, int pageSize) {
        return spitDao.selectContentListByUserId(userid, pageNum, pageSize);
    }

    public void addThumbupById(String id) {
        spitDao.addThumbupById(id);
    }

    public void add(Spit spit) {
        spit.set_id(idWorker.nextId()+"");
        spitDao.add(spit);
    }

    public void addVisitsAndShare(String id, Integer visits, Integer share) {
        spitDao.addVisitsAndShare(id,visits,share);
    }

    public void deleteTumbupById(String id) {
        spitDao.deleteHumbupById(id);
    }
}
